10 HOME
20 PRINT CHR$(4);"PR#3"
22 DIM B(20,80)
23 DIM C(1510)
24 DIM W(1,5)

25 X1=10:Y1=42:X9=10:Y9=40:V8=10:V9=38:BB=0:LL=0:O1=0:G1=0:MA=0

26 FOR I=1 TO 8
27 M(I)=I
28 NEXT I

30 ONERR GOTO 31

31 INVERSE:VTAB 1:HTAB 30:PRINT"MAZE GAME":VTAB 23:HTAB 1:PRINT"                                                                               ":VTAB 23:HTAB 1:INPUT"INPUT A NUMBER BETWEEN 1 TO 99999 : ";RR:NORMAL
32 IF RR<1 OR RR>99999 THEN 31

33 ONERR GOTO 34

34 HOME:INVERSE:VTAB 23:HTAB 1:PRINT" PLEASE INSERT A DATA DISK IN SLOT 6 DRIVE 2,THEN PRESS <SPC> TO BE CONTINUE. ":VTAB 23:HTAB 79:GET G$:VTAB 23:HTAB 79:PRINT G$:NORMAL

35 IF G$<>" " THEN 34

36 NORMAL:D2=1:GOSUB 15800


39 NORMAL:HOME:ONERR GOTO 22200



42 T$="R  DR  D  DL  L  UL  U  UR "


44 VTAB 10:HTAB 40:PRINT " "
45 VTAB 10:HTAB 40:PRINT "M"
50 INVERSE:VTAB 10:HTAB 42:PRINT "$":NORMAL
52 VTAB 20:HTAB 6:PRINT"Y":VTAB 20:HTAB 10:PRINT"I":VTAB 20:HTAB 15:PRINT"R - RUN":VTAB 20:HTAB 25:PRINT"S - SAVE MAZE":VTAB 20:HTAB 66:PRINT"DOLLAR :    0"
54 VTAB 21 :HTAB 5:PRINT"G H":VTAB 21:HTAB 9:PRINT"J K":VTAB 21:HTAB 15:PRINT"F - GAME":VTAB 21:HTAB 25:PRINT"L - LOAD MAZE":VTAB 21:HTAB 42:PRINT"X - CATALOG":VTAB 21:HTAB 55:PRINT"        ":VTAB 21:HTAB 66:PRINT"  STEP :    0"
56 VTAB 22 :HTAB 6:PRINT"B":VTAB 22:HTAB 10:PRINT"M":VTAB 22:HTAB 15:PRINT"Q - QUIT":VTAB 22:HTAB 25:PRINT"C - CLEAR SCN":VTAB 22:HTAB 42:PRINT"               ":VTAB 22:HTAB 66:PRINT"RESTEP :    0"

58 INVERSE:VTAB 23:HTAB 1:PRINT"                                                                               ":NORMAL

59 GOSUB 1200

60 NO=0:R1=0

61 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

62 IF V8=10 AND V9=38 AND G1=0 THEN 64

63 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL:VTAB V8:HTAB V9:PRINT"T"

64 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 1:PRINT"COMMAND :                                   ":VTAB 23:HTAB 15:PRINT T$:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

65 IF A$="Q" THEN 9000

74 IF A$=CHR$(25) THEN X2=X1-1:Y2=Y1:GOSUB 62000
75 IF A$=CHR$(7) THEN X2=X1:Y2=Y1-1:GOSUB 62000
76 IF A$=CHR$(8) THEN X2=X1:Y2=Y1+1:GOSUB 62000
77 IF A$=CHR$(2) THEN X2=X1+1:Y2=Y1:GOSUB 62000

78 IF A$="I" THEN X2=X1-1:Y2=Y1:GOSUB 62100
80 IF A$="J" THEN X2=X1:Y2=Y1-1:GOSUB 62100
90 IF A$="K" THEN X2=X1:Y2=Y1+1:GOSUB 62100
95 IF A$="M" THEN X2=X1+1:Y2=Y1:GOSUB 62100

100 IF A$="Y" THEN X2=X1-1:Y2=Y1:GOSUB 62200
110 IF A$="G" THEN X2=X1:Y2=Y1-1:GOSUB 62200
120 IF A$="H" THEN X2=X1:Y2=Y1+1:GOSUB 62200
130 IF A$="B" THEN X2=X1+1:Y2=Y1:GOSUB 62200

160 IF A$="R" THEN 300
170 IF A$="S" THEN 15000
180 IF A$="L" THEN 15100
182 IF A$="C" THEN 15500
184 IF A$="X" THEN 15800


189 IF A$="F" THEN 10000


197 IF A$=CHR$(20) THEN 34000
198 IF A$=CHR$(15) THEN 30000

199 IF A$=CHR$(18) THEN G1=0:GOTO 41000


200 GOTO 60

300 X4=X9:Y4=Y9:I1=1:S1=0:H2=0
305 VTAB 20:HTAB 44:PRINT"                ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL


308 IF G1>0 THEN GOSUB 40000


310 IF B(X9,Y9)=1 THEN B(X9,Y9)=0:VTAB X9:HTAB Y9:PRINT"M":BB=BB-1:GOSUB 1200

312 IF B(V8,V9)=1 AND G1>0 THEN B(V8,V9)=0:VTAB V8:HTAB V9:PRINT"T":BB=BB-1:GOSUB 1200 

314 IF B(X9,Y9+1)=1 AND B(X9+1,Y9+1)=1 AND B(X9+1,Y9)=1 AND B(X9+1,Y9-1)=1 AND B(X9,Y9-1)=1 AND B(X9-1,Y9-1)=1 AND B(X9-1,Y9)=1 AND B(X9-1,Y9+1)=1 THEN INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 60

315 VTAB X4:HTAB Y4:PRINT"M"
320 X5=X4:Y5=Y4

325 FOR I8=1 TO 8

330 IF M(I8)=4 AND B(X4+1,Y4-1)=0 THEN XX=X4+1:YY=Y4-1:Q=5:F1=1:GOTO 530
340 IF M(I8)=3 AND B(X4+1,Y4)=0 THEN XX=X4+1:YY=Y4:Q=4:F1=2:GOTO 530
350 IF M(I8)=2 AND B(X4+1,Y4+1)=0 THEN XX=X4+1:YY=Y4+1:Q=6:F1=3:GOTO 530
360 IF M(I8)=1 AND B(X4,Y4+1)=0 THEN XX=X4:YY=Y4+1:Q=3:F1=4:GOTO 530
370 IF M(I8)=8 AND B(X4-1,Y4+1)=0 THEN XX=X4-1:YY=Y4+1:Q=7:F1=5:GOTO 530
380 IF M(I8)=7 AND B(X4-1,Y4)=0 THEN XX=X4-1:YY=Y4:Q=2:F1=6:GOTO 530
390 IF M(I8)=6 AND B(X4-1,Y4-1)=0 THEN XX=X4-1:YY=Y4-1:Q=8:F1=7:GOTO 530
395 IF M(I8)=5 AND B(X4,Y4-1)=0 THEN XX=X4:YY=Y4-1:Q=1:F1=8:GOTO 530

398 NEXT I8

400 I1=I1-1:IF I1<1 THEN I1=1
410 A7=C(I1):C(I1)=23:H2=H2+1:N1=22:N2=78:GOSUB 900
420 IF A7=1 THEN YY=Y4+1:XX=X4
430 IF A7=4 THEN XX=X4-1:YY=Y4
440 IF A7=3 THEN YY=Y4-1:XX=X4
450 IF A7=2 THEN XX=X4+1:YY=Y4
460 IF A7=5 THEN XX=X4-1:YY=Y4+1
470 IF A7=6 THEN XX=X4-1:YY=Y4-1
480 IF A7=7 THEN XX=X4+1:YY=Y4-1
490 IF A7=8 THEN XX=X4+1:YY=Y4+1
500 GOTO 550
530 IF B(XX,YY)=2 THEN XX=X4:YY=Y4:ON F1 GOTO 340,350,360,370,380,390,395,400
540 C(I1)=Q:I1=I1+1
550 VTAB X4:HTAB Y4:PRINT" ":B(XX,YY)=2 

552 IF G1>0 AND XX=V8 AND YY=V9 THEN VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650

560 IF XX>19 OR XX<1 OR YY>79 OR YY<1 THEN VTAB X5:HTAB Y5:PRINT" ":GOSUB 27000:S1=0:H2=0:GOTO 650
570 X4=XX:Y4=YY:VTAB X4:HTAB Y4:PRINT"M":VTAB X5:HTAB Y5:PRINT" "
575 IF XX=X9 AND YY=Y9 THEN R1=R1+1:GOSUB 28000
577 IF R1>8 THEN R1=0:NO=1:INVERSE:VTAB 20:HTAB 44:PRINT"NO EXIT":NORMAL:GOTO 650
580 S1=S1+1:N1=21:N2=78
590 IF S1>9 THEN N2=N2-1
600 IF S1>99 THEN N2=N2-1
610 IF S1>999 THEN N2=N2-1
620 VTAB N1:HTAB N2: PRINT S1
640 GOTO 315

650 INVERSE:VTAB 23:HTAB 1:PRINT"              WAITING                       ":NORMAL
660 FOR I=0 TO 20
670 FOR J=0 TO 80
680 IF B(I,J)<>1 THEN B(I,J)=0
690 NEXT J
700 NEXT I
705 INVERSE:VTAB 23:HTAB 15:PRINT"        ":NORMAL
710 GOTO 60
 

900 IF H2>9 THEN N2=N2-1
910 IF H2>99 THEN N2=N2-1
920 IF H2>999 THEN N2=N2-1
930 VTAB N1:HTAB N2: PRINT H2
940 RETURN

1000 IF X2<1 THEN X2=19
1010 IF X2>19 THEN X2=1
1020 IF Y2<1 THEN Y2=79
1030 IF Y2>79 THEN Y2=1

1040 RETURN



1042 IF X2<2 THEN X2=18
1043 IF X2>18 THEN X2=2
1044 IF Y2<2 THEN Y2=78
1045 IF Y2>78 THEN Y2=2

1046 RETURN


1050 IF X1<2 THEN X1=18
1060 IF X1>18 THEN X1=2
1070 IF Y1<2 THEN Y1=78
1080 IF Y1>78 THEN Y1=2

1090 RETURN









1100 IF B(X1,Y1)=0 THEN BB=BB+1
1110 RETURN 

1150 IF B(X1,Y1)=1 THEN BB=BB-1
1160 RETURN

1200 IF BB<0 THEN BB=0
1210 IF BB<10 AND BB>-1 THEN NN1=78
1220 IF BB<100 AND BB>9 THEN NN1=77
1230 IF BB<1000 AND BB>99 THEN NN1=76
1240 IF BB<10000 AND BB>999 THEN NN1=75
1250 VTAB 20:HTAB 75:PRINT"    "
1260 VTAB 20:HTAB NN1:PRINT BB
1270 RETURN


9000 HOME:PRINT CHR$(4);"CATALOG"+",D1,S6":END



10000 NORMAL:VTAB 20:HTAB 44:PRINT"                      " 


10002 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                                                     ":VTAB 23:HTAB 50:PRINT"MAZE GAME     ":VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

10010 IF A$="U" THEN X2=10:Y2=42:GOTO 11000

10040 IF A$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 14500

10060 GOTO 10002

11000 VTAB X9:HTAB Y9:PRINT"M":INVERSE:VTAB X1:HTAB Y1:PRINT"$":NORMAL

11002 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                                                     ":VTAB 23:HTAB 50:PRINT"TUBE MAKER":VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

 
11070 IF A$=CHR$(43) THEN INVERSE:VTAB X1:HTAB Y1:PRINT"$":VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 10002

11080 IF A$="B" THEN VTAB 20:HTAB 44:PRINT"         ":FOR I=1 TO 1510:C(I)=0:NEXT I:GOTO 11500

11082 IF A$="A" THEN VTAB 20:HTAB 44:PRINT"         ":FOR I=1 TO 1510:C(I)=0:NEXT I:GOSUB 14300


11090 GOTO 11000



11500 CS=1:GOSUB 14900:X2=X1:Y2=Y1:GOSUB 13400:GOSUB 12100:GOSUB 14078

11510 VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$

11666 IF A$=CHR$(25) THEN X2=X1-1:Y2=Y1:GOSUB 1042:GOSUB 1050:GOSUB 29500:GOSUB 12100:X1=X2:Y1=Y2
11667 IF A$=CHR$(7) THEN X2=X1:Y2=Y1-1:GOSUB 1042:GOSUB 1050:GOSUB 29500:GOSUB 12100:X1=X2:Y1=Y2
11668 IF A$=CHR$(8) THEN X2=X1:Y2=Y1+1:GOSUB 1042:GOSUB 1050:GOSUB 29500:GOSUB 12100:X1=X2:Y1=Y2
11669 IF A$=CHR$(2) THEN X2=X1+1:Y2=Y1:GOSUB 1042:GOSUB 1050:GOSUB 29500:GOSUB 12100:X1=X2:Y1=Y2


11677 IF A$="J" THEN CS=CS-1:GOSUB 29500:GOSUB 12100
11678 IF A$="K" THEN CS=CS+1:GOSUB 29500:GOSUB 12100
11679 IF A$="M" THEN GOSUB 13900

11680 IF A$="S" THEN GOSUB 14600
11681 IF A$="L" THEN GOSUB 14700

11686 IF A$=CHR$(43) THEN RC=0:CU=0:INVERSE:VTAB X1:HTAB Y1:PRINT"$":INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 11000

11690 GOTO 11510 



12100 IF CS>8 THEN CS=1
12110 IF CS<1 THEN CS=8


12200 IF CS=1 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12202 IF CS=1 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12206 IF CS=1 AND X2-1<1 THEN 12216  
12210 IF CS=1 THEN VTAB X2-1:HTAB Y2:PRINT" ":W(1,1)=100*(X2-1)+Y2:W(0,1)=100*(X2-1-1)+Y2
12216 IF CS=1 AND (X2+1>19 OR Y2-1<1 ) THEN 13300 
12220 IF CS=1 THEN VTAB X2+1:HTAB Y2-1:PRINT" ":W(1,2)=100*(X2+1)+Y2-1:W(0,2)=100*(X2+1+1)+Y2-1-1


12300 IF CS=2 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12302 IF CS=2 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12306 IF CS=2 AND X2-1<1 THEN 12316  
12310 IF CS=2 THEN VTAB X2-1:HTAB Y2:PRINT" ":W(1,1)=100*(X2-1)+Y2:W(0,1)=100*(X2-1-1)+Y2
12316 IF CS=2 AND (X2+1>19 OR Y2+1>79) THEN 13300 
12320 IF CS=2 THEN VTAB X2+1:HTAB Y2+1:PRINT" ":W(1,2)=100*(X2+1)+Y2+1:W(0,2)=100*(X2+1+1)+Y2+1+1

12400 IF CS=3 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12402 IF CS=3 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12406 IF CS=3 AND X2+1>19 THEN 12416  
12410 IF CS=3 THEN VTAB X2+1:HTAB Y2:PRINT" ":W(1,1)=100*(X2+1)+Y2:W(0,1)=100*(X2+1+1)+Y2
12416 IF CS=3 AND (X2-1<1 OR Y2-1<1) THEN 13300 
12420 IF CS=3 THEN VTAB X2-1:HTAB Y2-1:PRINT" ":W(1,2)=100*(X2-1)+Y2-1:W(0,2)=100*(X2-1-1)+Y2-1-1


12500 IF CS=4 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12502 IF CS=4 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12506 IF CS=4 AND X2+1>19 THEN 12516  
12510 IF CS=4 THEN VTAB X2+1:HTAB Y2:PRINT" ":W(1,1)=100*(X2+1)+Y2:W(0,1)=100*(X2+1+1)+Y2
12516 IF CS=4 AND (X2-1<1 OR Y2+1>79) THEN 13300 
12520 IF CS=4 THEN VTAB X2-1:HTAB Y2+1:PRINT" ":W(1,2)=100*(X2-1)+Y2+1:W(0,2)=100*(X2-1-1)+Y2+1+1


12600 IF CS=5 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12602 IF CS=5 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12616 IF CS=5 AND Y2+1>79 THEN 12626 
12620 IF CS=5 THEN VTAB X2:HTAB Y2+1:PRINT" ":W(1,1)=100*(X2)+Y2+1:W(0,1)=100*(X2)+Y2+1+1
12626 IF CS=5 AND (X2-1<1 OR Y2-1<1) THEN 13300 
12630 IF CS=5 THEN VTAB X2-1:HTAB Y2-1:PRINT" ":W(1,2)=100*(X2-1)+Y2-1:W(0,2)=100*(X2-1-1)+Y2-1-1


12700 IF CS=6 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12702 IF CS=6 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12706 IF CS=6 AND Y2+1>79 THEN 12716  
12710 IF CS=6 THEN VTAB X2:HTAB Y2+1:PRINT" ":W(1,1)=100*(X2)+Y2+1:W(0,1)=100*(X2)+Y2+1+1
12716 IF CS=6 AND (X2+1>19 OR Y2-1<1) THEN 13300 
12720 IF CS=6 THEN VTAB X2+1:HTAB Y2-1:PRINT" ":W(1,2)=100*(X2+1)+Y2-1:W(0,2)=100*(X2+1+1)+Y2-1-1



12800 IF CS=7 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12802 IF CS=7 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12806 IF CS=7 AND Y2-1<1 THEN 12826  
12810 IF CS=7 THEN VTAB X2:HTAB Y2-1:PRINT" ":W(1,1)=100*(X2)+Y2-1:W(0,1)=100*(X2)+Y2-1-1
12826 IF CS=7 AND (X2-1<1 OR Y2+1>79) THEN 13300 
12830 IF CS=7 THEN VTAB X2-1:HTAB Y2+1:PRINT" ":W(1,2)=100*(X2-1)+Y2+1:W(0,2)=100*(X2-1-1)+Y2+1+1


12900 IF CS=8 THEN W(1,3)=100*X2+Y2:W(1,4)=0:W(1,5)=0:W(0,3)=0:W(0,4)=0:W(0,5)=0
12902 IF CS=8 THEN INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
12916 IF CS=8 AND Y2-1<1 THEN 12926 
12920 IF CS=8 THEN VTAB X2:HTAB Y2-1:PRINT" ":W(1,1)=100*(X2)+Y2-1:W(0,1)=100*(X2)+Y2-1-1
12926 IF CS=8 AND (X2+1>19 OR Y2+1>79) THEN 13300 
12930 IF CS=8 THEN VTAB X2+1:HTAB Y2+1:PRINT" ":W(1,2)=100*(X2+1)+Y2+1:W(0,2)=100*(X2+1+1)+Y2+1+1



13300 RETURN


13400 CU=1:INVERSE


13408 IF X9-1<1 THEN 13411 
13410 VTAB X9-1:HTAB Y9:PRINT"J":AO=100*(X9-1)+Y9:GOSUB 16000:C(CU)=AO:CU=CU+1
13411 IF X9+1>19 THEN 13413 
13412 VTAB X9+1:HTAB Y9:PRINT"J":AO=100*(X9+1)+Y9:GOSUB 16000:C(CU)=AO:CU=CU+1
13413 IF Y9-1<1 THEN 13415 
13414 VTAB X9:HTAB Y9-1:PRINT"J":AO=100*(X9)+Y9-1:GOSUB 16000:C(CU)=AO:CU=CU+1
13415 IF Y9+1>79 THEN 13417 
13416 VTAB X9:HTAB Y9+1:PRINT"J":AO=100*(X9)+Y9+1:GOSUB 16000:C(CU)=AO:CU=CU+1



13417 IF G1>0 AND V8-1<1 THEN 13419 
13418 IF G1>0 THEN VTAB V8-1:HTAB V9:PRINT"J":AO=100*(V8-1)+V9:GOSUB 16000:C(CU)=AO:CU=CU+1
13419 IF G1>0 AND V8+1>19 THEN 13421 
13420 IF G1>0 THEN VTAB V8+1:HTAB V9:PRINT"J":AO=100*(V8+1)+V9:GOSUB 16000:C(CU)=AO:CU=CU+1
13421 IF G1>0 AND V9-1<1 THEN 13423 
13422 IF G1>0 THEN VTAB V8:HTAB V9-1:PRINT"J":AO=100*(V8)+V9-1:GOSUB 16000:C(CU)=AO:CU=CU+1
13423 IF G1>0 AND V9+1>79 THEN 13430 
13424 IF G1>0 THEN VTAB V8:HTAB V9+1:PRINT"J":AO=100*(V8)+V9+1:GOSUB 16000:C(CU)=AO:CU=CU+1



13430 IF G1>0 THEN NORMAL:RETURN

13460 FOR I=1 TO 19

13462 IF (X9=I AND Y9=1) THEN 13466 

13464 VTAB I:HTAB 1:PRINT"J":AO=100*(I)+1:GOSUB 16000:C(CU)=AO:CU=CU+1

13466 IF (X9=I AND Y9=79) THEN 13469 

13468 VTAB I:HTAB 79:PRINT"J":AO=100*(I)+79:GOSUB 16000:C(CU)=AO:CU=CU+1

13469 NEXT I

13470 FOR J=2 TO 78

13472 IF (X9=1 AND Y9=J) THEN 13476
13474 VTAB 1:HTAB J:PRINT"J":AO=100+J:GOSUB 16000:C(CU)=AO:CU=CU+1
13476 IF (X9=19 AND Y9=J) THEN 13478
13477 VTAB 19:HTAB J:PRINT"J":AO=1900+J:GOSUB 16000:C(CU)=AO:CU=CU+1


13478 NEXT J

13479 NORMAL:VTAB X9:HTAB Y9:PRINT"M"

13480 RETURN


13900 JP=0

13902 FOR P=1 TO 5
13906 FOR Q=1 TO CU-1

13907 IF W(1,P)=0 OR W(1,P)=100*X2+Y2 THEN RETURN

13908 IF W(1,P)=C(Q) THEN PP=P:PR=Q
13909 IF W(1,P)=C(Q) THEN GOSUB 14000



13910 NEXT Q
13911 NEXT P

13912 RETURN


14000 NORMAL
14001 JP=JP+1
14002 IF JP>1 THEN 14044

14003 XZ=INT(C(PR)/100):YZ=C(PR)-100*XZ

14025 FOR K=1 TO 5
14026 XW=INT(W(1,K)/100):YW=W(1,K)-100*XW
14028 IF XW<>0 AND YW<>0 AND B(XW,YW)=0 THEN RETURN  
14029 NEXT K


14044 JJ=JJ+1:VTAB XZ:HTAB YZ:PRINT" "
14045 FOR K=1 TO 5
14046 XW=INT(W(1,K)/100):YW=W(1,K)-100*XW
14048 IF XW<>0 AND YW<>0 THEN VTAB XW:HTAB YW:PRINT" ":B(XW,YW)=0
14049 NEXT K

14051 INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
14052 KK=KK+1:C(PR)=-1
14054 GOSUB 49500  

14064 FOR L=1 TO 5
14065 XF=INT(W(0,L)/100):YF=W(0,L)-100*XF
14066 IF B(XF,YF)=0 THEN 14069
14067 IF XF<1 OR XF>19 OR YF<1 OR YF>79 OR (XF=X9 AND YF=Y9) OR (G1>0 AND XF=V8 AND YF=V9) THEN 14069
14068 IF XF<>0 AND YF<>0 THEN INVERSE:VTAB XF:HTAB YF:PRINT"J":AO=W(0,L):GOSUB 16000:C(CU)=AO:NORMAL:CU=CU+1
14069 NEXT L

14078 RC=0
14080 FOR I=1 TO 1510
14082 IF C(I)>0 THEN RC=RC+1
14084 INVERSE:VTAB 23:HTAB 74:PRINT"     ":VTAB 23:HTAB 66:PRINT"JOINT : ";RC:NORMAL
14086 NEXT I



14200 RETURN


14300 CS=1:GOSUB 14900:X2=X1:Y2=Y1:GOSUB 13400:GOSUB 14078:GOSUB 12100


14301 FOR U=1 TO 10000
14302 GOSUB 14400
14303 X2=INT(RND(RR)*17+2)
14304 GOSUB 14400
14305 Y2=INT(RND(RR)*77+2)


14307 GOSUB 14400
14308 GOSUB 29500
14309 CS=INT(RND(RR)*8+1)
14310 GOSUB 12100

14311 X1=X2:Y1=Y2

14312 GOSUB 13900

14322 NEXT U

14324 RETURN




14400 FOR I=1 TO RR
14401 TE=RND(RR)
14402 NEXT I

14403 RR=TE

14406 RETURN


14500 IF F$<>"" THEN 15110
14510 GOTO 15500



14600 INVERSE:VTAB 23:HTAB 1:PRINT"                                                 ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL

14605 INVERSE:VTAB 23:HTAB 50:PRINT"SAVING":NORMAL
14607 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        TUBE MAKER                    ":NORMAL:RETURN
14609 IF LEN(F$) > 24 THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 14600




14611 TB=1:GOSUB 15012


14656 PRINT CHR$(4);"OPEN";F$+".JOINT"
14658 PRINT CHR$(4);"WRITE";F$+".JOINT" 
14660 FOR I=1 TO 1510
14662 PRINT C(I)
14664 NEXT I
14666 PRINT CHR$(4);"CLOSE";F$+".JOINT"

14676 PRINT CHR$(4);"OPEN";F$+".JOINT.INDEX"
14678 PRINT CHR$(4);"WRITE";F$+".JOINT.INDEX" 
14682 PRINT CS:PRINT CU
14686 PRINT CHR$(4);"CLOSE";F$+".JOINT.INDEX"


14688 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        TUBE MAKER  ":NORMAL

14690 RETURN



14700 INVERSE:VTAB 23:HTAB 1:PRINT"                                                 ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL

14705 INVERSE:VTAB 23:HTAB 50:PRINT"LOADING":NORMAL
14707 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        TUBE MAKER                    ":NORMAL:RETURN
14709 IF LEN(F$) > 24 THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 14700




14711 TB=1:GOSUB 15110

14716 FOR I=1 TO 1510:C(I)=0:NEXT I 


14756 PRINT CHR$(4);"READ";F$+".JOINT" 
14760 FOR I=1 TO 1510
14762 INPUT C(I)
14764 NEXT I
14766 PRINT CHR$(4);"CLOSE";F$+".JOINT"

14776 PRINT CHR$(4);"READ";F$+".JOINT.INDEX" 
14782 INPUT CS:INPUT CU
14786 PRINT CHR$(4);"CLOSE";F$+".JOINT.INDEX"


14787 GOSUB 14800:X2=X1:Y2=Y1:GOSUB 12100:GOSUB 14078 

14788 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        TUBE MAKER  ":VTAB 23:HTAB 66:PRINT"JOINT : ";RC:NORMAL

14789 NORMAL

14790 VTAB X9:HTAB Y9:PRINT"M"
14792 IF G1>0 THEN VTAB V8:HTAB V9:PRINT"T"

14796 RETURN

14800 GOSUB 15200
14810 FOR N=1 TO 1510
14812 IF C(N)=-1 OR C(N)=0 THEN 14840
14820 XQ=INT(C(N)/100):YQ=C(N)-100*XQ

14822 IF XQ<1 OR XQ>19 OR YQ<1 OR YQ>79 THEN 14840

14830 INVERSE:VTAB XQ:HTAB YQ:PRINT"J":NORMAL
14840 NEXT N
14860 RETURN




14900 BB=0
14902 FOR I=1 TO 19
14910 FOR J=1 TO 79

14915 IF (I=X9 AND J=Y9) THEN 14930
14916 IF (I=V8 AND J=V9) AND G1>0 THEN 14930

14920 VTAB I:HTAB J:PRINT"$":B(I,J)=1:BB=BB+1:GOSUB 1200
14930 NEXT J
14940 NEXT I

14960 RETURN


 


15000 INVERSE:VTAB 23:HTAB 1:PRINT"                                                 ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL

15005 INVERSE:VTAB 23:HTAB 50:PRINT"SAVING":NORMAL
15007 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60

15009 IF LEN(F$) > 24 THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 15000



15012 PRINT CHR$(4);"OPEN";F$
15020 PRINT CHR$(4);"WRITE";F$ 
15030 FOR I=1 TO 19
15040 FOR J=1 TO 79
15050 PRINT B(I,J)
15060 NEXT J
15070 NEXT I
15080 PRINT CHR$(4);"CLOSE";F$

15081 PRINT CHR$(4);"OPEN";F$+".INDEX"
15082 PRINT CHR$(4);"WRITE";F$+".INDEX"
15083 PRINT X1:PRINT Y1:PRINT X9:PRINT Y9:PRINT V8:PRINT V9:PRINT G1:PRINT M(1):PRINT M(2):PRINT M(3):PRINT M(4):PRINT M(5):PRINT M(6):PRINT M(7):PRINT M(8):PRINT T$:PRINT MA
15084 PRINT CHR$(4);"CLOSE";F$+".INDEX"

15086 PRINT CHR$(4);"OPEN";F$+".BITMAP"
15088 PRINT CHR$(4);"WRITE";F$+".BITMAP" 
15090 FOR I=1 TO 19
15091 FOR J=1 TO 79
15092 PRINT B(I,J);
15093 NEXT J
15094 PRINT
15095 NEXT I
15096 PRINT CHR$(4);"CLOSE";F$+".BITMAP"


15097 IF TB=1 THEN TB=0:RETURN


15098 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL
15099 GOTO 60

15100 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":VTAB 23:HTAB 1:INPUT"FILENAME : ";F$:NORMAL
15105 INVERSE:VTAB 23:HTAB 50:PRINT"LOADING":NORMAL
15106 IF F$=CHR$(43) THEN INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL:GOTO 60


15110 PRINT CHR$(4);"READ";F$ 
15130 FOR I=1 TO 19
15140 FOR J=1 TO 79
15150 INPUT B(I,J)
15160 NEXT J
15170 NEXT I
15172 PRINT CHR$(4);"CLOSE";F$
15174 PRINT CHR$(4);"READ";F$+".INDEX"
15178 INPUT X1:INPUT Y1:INPUT X9:INPUT Y9:INPUT V8:INPUT V9:INPUT G1:INPUT M(1):INPUT M(2):INPUT M(3):INPUT M(4):INPUT M(5):INPUT M(6):INPUT M(7):INPUT M(8):INPUT T$:INPUT MA
15180 PRINT CHR$(4);"CLOSE";F$+".INDEX"

15182 IF TB=1 THEN TB=0:RETURN 

15185 IF M(5)=0 THEN FOR I=1 TO 8:M(I)=I:NEXT I:T$="R  DR  D  DL  L  UL  U  UR "

15186 INVERSE:VTAB 23:HTAB 12:PRINT"                                                                    ":NORMAL
15187 GOSUB 15200


15188 IF G1>0 THEN INVERSE:VTAB 23:HTAB 50:PRINT"TARGET MODE     ":NORMAL
15190 IF G1=0 THEN RN=1:GOSUB 41000


15196 NORMAL:VTAB 20:HTAB 44:PRINT"                "

15198 LL=1:GOSUB 1200:GOTO 60

15200 BB=0:VTAB 20:HTAB 75:PRINT"    ":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0" 
15202 FOR I=1 TO 19
15210 FOR J=1 TO 79
15220 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1:GOSUB 1200
15222 IF B(I,J)<>1 THEN VTAB I:HTAB J:PRINT" "
15230 NEXT J
15240 NEXT I
15250 RETURN




15500 NORMAL:VTAB 20:HTAB 44:PRINT"                ":INVERSE:VTAB 23:HTAB 66:PRINT"             ":NORMAL

15502 FOR I=1 TO 19
15510 FOR J=1 TO 79
15520 VTAB I:HTAB J:PRINT" "
15530 NEXT J
15540 NEXT I

15542 FOR I=0 TO 20
15543 FOR J=0 TO 80
15544 B(I,J)=0
15545 NEXT J
15546 NEXT I

15548 BB=0
15549 VTAB 20:HTAB 75:PRINT"   0":VTAB 21:HTAB 75:PRINT"   0":VTAB 22:HTAB 75:PRINT"   0"
15550 GOTO 60

15800 HOME
15802 PRINT CHR$(4);"CATALOG"+",D2,S6"
15810 PRINT:PRINT"<PRESS ANY KEY TO BE CONTINUE>":NORMAL:GET CT$:PRINT CT$
15820 HOME:BB=0
15830 FOR I=1 TO 19
15840 FOR J=1 TO 79
15850 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$":BB=BB+1
15860 NEXT J
15870 NEXT I

15880 IF D2=1 THEN D2=0:RETURN

15990 GOTO 52

16000 FOR W=1 TO 1510
16002 IF C(W)=AO THEN AO=-1
16004 NEXT W

16006 RETURN


22200 INVERSE:VTAB 23:HTAB 50:PRINT"ERROR OCCURED":NORMAL:FOR I=1 TO 50000:NEXT I:GOTO 60


27000 S1=S1+1:N1=21:N2=78
27010 IF S1>9 THEN N2=N2-1
27020 IF S1>99 THEN N2=N2-1
27030 IF S1>999 THEN N2=N2-1
27040 VTAB N1:HTAB N2: PRINT S1
27050 RETURN


28000 IF R1>8 THEN RETURN
28010 INVERSE:VTAB 23:HTAB 66:PRINT"ROOT PASS : ";R1:NORMAL
28020 RETURN

29000 IF X1=X9 AND Y1=Y9 THEN 29040
29010 IF B(X1,Y1)=1 THEN NORMAL:VTAB X1:HTAB Y1:PRINT"$"
29020 IF B(X1,Y1)=0 THEN NORMAL:VTAB X1:HTAB Y1:PRINT" "
29030 IF X2=X9 AND Y2=Y9 THEN 29050
29040 INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL
 

29050 RETURN



29500 FOR I=X1-2 TO X1+2
29510 FOR J=Y1-2 TO Y1+2

29520 IF I<1 OR I>19 THEN 29570
29525 IF J<1 OR J>79 THEN 29570

29530 IF B(I,J)=1 THEN VTAB I:HTAB J:PRINT"$"
29540 IF B(I,J)=0 THEN VTAB I:HTAB J:PRINT" "
29550 IF I=X9 AND J=Y9 THEN VTAB I:HTAB J:PRINT"M"
29560 IF I=V8 AND J=V9 AND G1>0 THEN VTAB I:HTAB J:PRINT"T"

29570 NEXT J
29580 NEXT I

29581 INVERSE
29582 FOR K=1 TO CU-1
29583 IF C(K)<1 THEN 29588
29584 XU=INT(C(K)/100):YU=C(K)-100*XU
29586 VTAB XU:HTAB YU:PRINT"J"
29588 NEXT K
29589 NORMAL


29596 RETURN


30000 O1=O1+1
30004 X8=10:Y8=40
30006 IF O1>1 THEN X8=X9:Y8=Y9
30007 IF LL=1 THEN X8=X9:Y8=Y9
30008 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        CHANGE ORIGINAL POSITION      ":NORMAL
30010 INVERSE:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL


30050 IF A$=CHR$(25) THEN X9=X8-1:Y9=Y8:GOSUB 62300
30060 IF A$=CHR$(7) THEN X9=X8:Y9=Y8-1:GOSUB 62300
30070 IF A$=CHR$(8) THEN X9=X8:Y9=Y8+1:GOSUB 62300
30080 IF A$=CHR$(2) THEN X9=X8+1:Y9=Y8:GOSUB 62300

30082 IF A$=CHR$(15) THEN 36000

30090 GOTO  30010




31000 IF B(X8,Y8)=1 THEN NORMAL:VTAB X8:HTAB Y8:PRINT"$"
31010 IF B(X8,Y8)=0 THEN NORMAL:VTAB X8:HTAB Y8:PRINT" "

31012 IF X8=V8 AND Y8=V9 AND G1>0 THEN NORMAL:VTAB V8:HTAB V9:PRINT"T"
31014 IF X8=X1 AND Y8=Y1 THEN INVERSE:VTAB X1:HTAB Y1:PRINT"$":NORMAL


31020 NORMAL:VTAB X9:HTAB Y9:PRINT"M"

31050 RETURN

32000 IF X9<1 THEN X9=19
32010 IF X9>19 THEN X9=1
32020 IF Y9<1 THEN Y9=79
32030 IF Y9>79 THEN Y9=1

32040 RETURN




34000 G1=G1+1
34002 G8=10:G9=38

34003 IF G1>1 OR LL=1 THEN G8=V8:G9=V9:NORMAL:VTAB G8:HTAB G9:PRINT"T":GOTO 34007


34004 NORMAL:VTAB G8:HTAB G9:PRINT"T"

34007 INVERSE:VTAB 23:HTAB 1:PRINT"COMMAND :                                        CHANGE TARGET POSITION        ":NORMAL
34010 INVERSE:VTAB 23:HTAB 11:GET A$:GOSUB 60000:VTAB 23:HTAB 11:PRINT A$:NORMAL

34050 IF A$=CHR$(25) THEN V8=G8-1:V9=G9:GOSUB 62400
34060 IF A$=CHR$(7) THEN V8=G8:V9=G9-1:GOSUB 62400
34070 IF A$=CHR$(8) THEN V8=G8:V9=G9+1:GOSUB 62400
34080 IF A$=CHR$(2) THEN V8=G8+1:V9=G9:GOSUB 62400

34082 IF A$=CHR$(20) THEN 38000


34090 GOTO  34010


35000 IF B(G8,G9)=1 THEN NORMAL:VTAB G8:HTAB G9:PRINT"$"
35010 IF B(G8,G9)=0 THEN NORMAL:VTAB G8:HTAB G9:PRINT" "

35012 IF G8=X9 AND G9=Y9 THEN NORMAL:VTAB X9:HTAB Y9:PRINT"M"
35014 IF G8=X1 AND G9=Y1 THEN INVERSE:VTAB X1:HTAB Y1:PRINT"$":NORMAL


35020 NORMAL:VTAB V8:HTAB V9:PRINT"T"

35050 RETURN


36000 IF B(X9,Y9)=1 THEN INVERSE:VTAB 23:HTAB 50:PRINT"STAND ON THE DOLLAR SIGN":GOTO 30010
36001 IF V8=10 AND V9=38 THEN 36010
36002 IF X9=V8 AND Y9=V9 THEN INVERSE:VTAB 23:HTAB 50:PRINT"M STAND ON T            ":GOTO 30010
36010 INVERSE:VTAB 23:HTAB 50:PRINT"                        ":NORMAL:GOTO 60

37000 IF V8<1 THEN V8=19
37010 IF V8>19 THEN V8=1
37020 IF V9<1 THEN V9=79
37030 IF V9>79 THEN V9=1

37040 RETURN


38000 IF B(V8,V9)=1 THEN INVERSE:VTAB 23:HTAB 50:PRINT"STAND ON THE DOLLAR SIGN":GOTO 34010
38002 IF X9=V8 AND Y9=V9 THEN INVERSE:VTAB 23:HTAB 50:PRINT"T STAND ON M            ":GOTO 34010
38010 INVERSE:VTAB 23:HTAB 50:PRINT"                        ":NORMAL:GOTO 60


40000 NORMAL:VTAB V8:HTAB V9:PRINT"T"

40002 FOR I=0 TO 80

40010 B(0,I)=1:B(20,I)=1
40020 NEXT I

40030 FOR J=0 TO 20
40040 B(J,0)=1:B(J,80)=1
40050 NEXT J


40090 RETURN

 
41000 IF RN=1 THEN 41006

41001 IF B(V8,V9)=1 THEN B(V8,V9)=0:BB=BB-1:GOSUB 1200 

41002 NORMAL:VTAB V8:HTAB V9:PRINT" ":G1=0:V8=10:V9=38

41006 INVERSE:VTAB 23:HTAB 50:PRINT"COMMON MODE     ":NORMAL

41008 FOR I=0 TO 80

41010 B(0,I)=0:B(20,I)=0
41020 NEXT I

41030 FOR J=0 TO 20
41040 B(J,0)=0:B(J,80)=0
41050 NEXT J

41060 IF RN=1 THEN RN=0:RETURN
41090 GOTO 64


49500 BB=0

49502 FOR I=1 TO 19
49510 FOR J=1 TO 79
49520 IF B(I,J)=1 THEN BB=BB+1
49530 NEXT J
49540 NEXT I

49542 GOSUB 1200

49550 RETURN


60000 IF A$=CHR$(10) OR A$=CHR$(13) OR A$=CHR$(22) OR A$=CHR$(12) OR A$=CHR$(11) OR A$=CHR$(17) OR A$=CHR$(23) OR A$=CHR$(21) OR A$=CHR$(27) THEN A$=" "
60002 RETURN


62000 GOSUB 1000:GOSUB 29000:X1=X2:Y1=Y2
62010 RETURN

62100 GOSUB 1000:INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL:VTAB X1:HTAB Y1:PRINT"$":GOSUB 1100:B(X1,Y1)=1:GOSUB 1200:X1=X2:Y1=Y2
62110 RETURN

62200 GOSUB 1000:INVERSE:VTAB X2:HTAB Y2:PRINT"$":NORMAL:VTAB X1:HTAB Y1:PRINT" ":GOSUB 1150:B(X1,Y1)=0:GOSUB 1200:X1=X2:Y1=Y2
62210 RETURN


62300 GOSUB 32000:GOSUB 31000:X8=X9:Y8=Y9
62310 RETURN

62400 GOSUB 37000:GOSUB 35000:G8=V8:G9=V9
62410 RETURN







   